package cn.usian.service.impl;

import cn.usian.entity.DishFlavor;
import cn.usian.mapper.DishFlavorMapper;
import cn.usian.service.DishFlavorService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.time.LocalDateTime;
@Service
public class DishFlaoverServiceImpl implements DishFlavorService {
    @Resource
    private DishFlavorMapper dishFlavorMapper;

    @Override
    public void add(DishFlavor dishFlavor, HttpSession session) {
        Long employee =(Long) session.getAttribute("employee");
        dishFlavor.setCreateTime(LocalDateTime.now());
        dishFlavor.setUpdateTime(LocalDateTime.now());
        dishFlavor.setCreateUser(employee);
        dishFlavor.setUpdateUser(employee);
        dishFlavorMapper.insert(dishFlavor);
    }
}
